//
//  RoomMapCell.m
//  projecthz
//
//  Created by YDJH on 2017/4/21.
//  Copyright © 2017年 tali. All rights reserved.
//

#import "RoomMapCell.h"
#import "HZRoom.h"
#import "Masonry.h"
#import "HZFurniture_Header.h"

@interface RoomMapCell ()

@property (nonatomic,strong)UIImageView *stateImage;

@property (nonatomic,strong)HZRoom *model;

@end

NSString *const RoomMapCellID = @"RoomMapCellID";

@implementation RoomMapCell

- (UIImageView *)stateImage {
    if (!_stateImage) {
        _stateImage = [[UIImageView alloc] init];
    }
    return _stateImage;
}

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self setupViews];
    }
    
    return self;
}

- (void)setupViews {
    
//    self.contentView.backgroundColor = [UIColor grayColor];
    [self.contentView addSubview:self.stateImage];
    [self.stateImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView);
    }];
}

- (void)configureCellWithData:(id)data withCallBack:(RoomMapCell_CallBack)callBack {
    if ([data isKindOfClass:[HZRoom class]]) {
        _model = (HZRoom *)data;
        if ([_model.roomState isEqualToString:RoomState_Coming]) {
            self.stateImage.backgroundColor = [UIColor greenColor];
        }else if ([_model.roomState isEqualToString:RoomState_Came]) {
            self.stateImage.backgroundColor = [UIColor whiteColor];
        }else if ([_model.roomState isEqualToString:RoomState_NeverCome]) {
            self.stateImage.backgroundColor = [UIColor grayColor];
        }
    }
}

@end
